//
//  Loan_OrderSubmitViewController.m
//  JinFuThree
//
//  Created by 爱尚 on 2018/9/21.
//  Copyright © 2018年 毛韶谦. All rights reserved.
//

#import "Loan_OrderSubmitViewController.h"

@interface Loan_OrderSubmitViewController ()


@end

@implementation Loan_OrderSubmitViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.title = @"订单提交";
    self.view.backgroundColor = [UIColor whiteColor];
    [self initViews];
    
}

-(void)updateUIWith:(BOOL)isSuccess{
    if (isSuccess == YES) {
        self.IconImageView.image = [UIImage imageNamed:@"loan_ic_ticg"];
        self.tipLabel.text =  @"恭喜你！订单提交成功！";
        self.orderNumberLabel.text =@"订单编号：256176278922";
        [self.orderBtn setTitle:@"订单详情" forState:UIControlStateNormal];
    }else{
        self.IconImageView.image = [UIImage imageNamed:@"loan_ic_tjsb"];
        self.tipLabel.text = @"订单提交失败";
        self.orderNumberLabel.text = @"提交申请失败，刷新重试";
        [self.orderBtn setTitle:@"重新提交" forState:UIControlStateNormal];
    }
    
}



-(void)initViews{
    
    _IconImageView = [[UIImageView alloc]init];
    _IconImageView.image = [UIImage imageNamed:@"loan_ic_ticg"];
    _IconImageView.contentMode = UIViewContentModeScaleAspectFit;
    [self.view addSubview:_IconImageView];
    [self.IconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(self.view);
        make.top.mas_equalTo(self.view.mas_top).offset(ScreenWidthMao/375*67);
        make.width.mas_offset(@(ScreenWidthMao/375*129));
        make.height.mas_offset(@(ScreenWidthMao/375*169));
    }];
    
    _tipLabel = [[UILabel alloc]init];
//    _tipLabel.text = @"恭喜你！订单提交成功！";
    _tipLabel.textAlignment = NSTextAlignmentCenter;
    _tipLabel.font = [UIFont boldSystemFontOfSize:16];
    _tipLabel.textColor = ThemeMaoBlackColor;
    [self.view addSubview:self.tipLabel];
    [self.tipLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(self.view);
        make.top.mas_equalTo(self.IconImageView.mas_bottom).offset(ScreenWidthMao/375*12);
        make.height.mas_offset(@20);
        
    }];
    
    _orderNumberLabel = [[UILabel alloc]init];
    _orderNumberLabel.textColor = ThemeTintFontColor;
    _orderNumberLabel.textAlignment = NSTextAlignmentCenter;
    _orderNumberLabel.font = [UIFont systemFontOfSize:14];
//    _orderNumberLabel.text = @"订单编号：45277288292929292929282";
    [self.view addSubview:_orderNumberLabel];
    [self.orderNumberLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(self.view);
        make.top.mas_equalTo(self.tipLabel.mas_bottom).offset(10);
        make.height.mas_offset(@15);
        
    }];
    
    _orderBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [_orderBtn setTitle:@"订单详情" forState:UIControlStateNormal];
    [_orderBtn setBackgroundColor:ThemeMaoColor];
    [_orderBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    _orderBtn.titleLabel.font = [UIFont systemFontOfSize:15];
    [_orderBtn setBackgroundImage:[UIImage imageNamed:@"select_btn"] forState:UIControlStateNormal];
    _orderBtn.layer.masksToBounds = YES;
    _orderBtn.layer.cornerRadius = 4;
    [_orderBtn addTarget:self action:@selector(orderBtnAction) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:_orderBtn];
    [self.orderBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(self.view.mas_left).offset(25);
        make.right.mas_equalTo(self.view.mas_right).offset(-25);
        make.top.mas_equalTo(self.orderNumberLabel.mas_bottom).offset(30);
        make.height.mas_offset(@(44));
        
    }];
}
-(void)orderBtnAction{
    UIViewController *My_LoansViewController = [[Mediator sharedInstance] My_LoansViewController];
    [self.navigationController pushViewController:My_LoansViewController animated:YES];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
